package com.mooc.meetingfilm.utils.exception;

import com.mooc.meetingfilm.utils.common.vo.BaseResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ControllerAdvice
public class BaseExceptionHandler {
    @ExceptionHandler(BaseServiceException.class)
    @ResponseBody
    public BaseResponseVO handleBaseServiceException(BaseServiceException e){
        log.error("发生业务异常，code：{}，msg：{}", e.getCode(), e.getMessage());
        return BaseResponseVO.returnBaseServiceException(e);
    }
}
